<!DOCTYPE html><html><head><title>1.登陆</title><meta charset='utf-8'><link href='https://dn-maxiang.qbox.me/res-min/themes/marxico.css' rel='stylesheet'><style></style></head><body><div id='preview-contents' class='note-content'>
                        
                    

<p><a href="#id1">1.注册</a> <br>
<a href="#id2">2.登陆</a> <br>
<a href="#id3">3.上传文件</a> <br>
<a href="#id4">4.下载文件</a></p>



<h3 id="1登陆"><span id="id1">1.登陆</span></h3>

<h4 id="客户端">客户端</h4>

<table><tbody><tr style="font-weight:bold">  <td>参数</td>  <td>value</td>  <td>类型</td></tr><tr>  <td>password</td>  <td>密码</td>  <td>String</td></tr><tr>  <td>phone</td>  <td>电话</td>  <td>String</td></tr><tr>  <td>email</td>  <td>邮箱</td>  <td>String</td></tr></tbody></table>

<blockquote>
  <p>phone 、email二选一</p>
</blockquote>



<pre class="prettyprint hljs-dark"><code class="hljs groovy"><div class="hljs-line"><span class="hljs-string">url:</span> <span class="hljs-string">'localhost:3000/common/signUp'</span>,
</div><div class="hljs-line"><span class="hljs-string">methods:</span> <span class="hljs-string">'post'</span>
</div></code></pre>



<pre class="prettyprint hljs-dark"><code class="hljs haml"><div class="hljs-line">curl -X POST \
</div><div class="hljs-line">  http://localhost:3000/common/signUp \
</div><div class="hljs-line">  -<span class="ruby">H <span class="hljs-string">'Cache-Control: no-cache'</span> \</span>
</div><div class="hljs-line"><span class="ruby"></span>  -<span class="ruby">H <span class="hljs-string">'Content-Type: application/x-www-form-urlencoded'</span> \</span>
</div><div class="hljs-line"><span class="ruby"></span>  -<span class="ruby">H <span class="hljs-string">'Postman-Token: ac33fbd3-4e20-4e68-b429-f7d07f051e81'</span> \</span>
</div><div class="hljs-line"><span class="ruby"></span>  -<span class="ruby">d <span class="hljs-string">'phone=15021578502&amp;password=123456'</span></span>
</div></code></pre>



<h4 id="服务器返回">服务器返回</h4>



<pre class="prettyprint hljs-dark"><code class="hljs json"><div class="hljs-line">{
</div><div class="hljs-line">    <span class="hljs-attr">"code"</span>: <span class="hljs-number">0</span>,
</div><div class="hljs-line">    <span class="hljs-attr">"data"</span>: {
</div><div class="hljs-line">        <span class="hljs-attr">"msg"</span>: <span class="hljs-string">"signUp successful!"</span>
</div><div class="hljs-line">    }
</div><div class="hljs-line">}
</div></code></pre>



<h3 id="2登陆"><span id="id2">2.登陆</span></h3>



<h4 id="客户端-1">客户端</h4>

<table><tbody><tr style="font-weight:bold">  <td>参数</td>  <td>value</td>  <td>类型</td></tr><tr>  <td>password</td>  <td>密码</td>  <td>String</td></tr><tr>  <td>phone</td>  <td>电话</td>  <td>String</td></tr><tr>  <td>email</td>  <td>邮箱</td>  <td>String</td></tr></tbody></table>

<blockquote>
  <p>phone 、email二选一</p>
</blockquote>



<pre class="prettyprint hljs-dark"><code class="hljs groovy"><div class="hljs-line"><span class="hljs-string">url:</span> <span class="hljs-string">'localhost:3000/common/signIn'</span>,
</div><div class="hljs-line"><span class="hljs-string">methods:</span> <span class="hljs-string">'post'</span>
</div></code></pre>



<pre class="prettyprint hljs-dark"><code class="hljs haml"><div class="hljs-line">curl -X POST \
</div><div class="hljs-line">  http://localhost:3000/common/signIn \
</div><div class="hljs-line">  -<span class="ruby">H <span class="hljs-string">'Cache-Control: no-cache'</span> \</span>
</div><div class="hljs-line"><span class="ruby"></span>  -<span class="ruby">H <span class="hljs-string">'Content-Type: application/x-www-form-urlencoded'</span> \</span>
</div><div class="hljs-line"><span class="ruby"></span>  -<span class="ruby">H <span class="hljs-string">'Postman-Token: 23d2bcc6-8016-43a3-bd06-d45d5ca76586'</span> \</span>
</div><div class="hljs-line"><span class="ruby"></span>  -<span class="ruby">d <span class="hljs-string">'phone=15021578502&amp;password=123456'</span></span>
</div></code></pre>



<h4 id="服务器返回-1">服务器返回</h4>



<pre class="prettyprint hljs-dark"><code class="hljs json"><div class="hljs-line">{
</div><div class="hljs-line">    <span class="hljs-attr">"code"</span>: <span class="hljs-number">0</span>,
</div><div class="hljs-line">    <span class="hljs-attr">"data"</span>: {
</div><div class="hljs-line">        <span class="hljs-attr">"phone"</span>: <span class="hljs-string">"15021578502"</span>,
</div><div class="hljs-line">        <span class="hljs-attr">"createdAt"</span>: <span class="hljs-string">"2018-08-24T11:37:16.170Z"</span>,
</div><div class="hljs-line">        <span class="hljs-attr">"userId"</span>: <span class="hljs-number">10003</span>,
</div><div class="hljs-line">        <span class="hljs-attr">"token"</span>: <span class="hljs-string">"c917419c6961afaa5c626d99dc08213907c8cacf657df890"</span>
</div><div class="hljs-line">    }
</div><div class="hljs-line">}
</div></code></pre>



<h3 id="3上传文件"><span id="id3">3.上传文件</span></h3>



<h4 id="客户端-2">客户端</h4>

<table><tbody><tr style="font-weight:bold">  <td>参数</td>  <td>value</td>  <td>类型</td></tr><tr>  <td>files</td>  <td>文件的key</td>  <td>String</td></tr></tbody></table>

<blockquote>
  <p>支持多文件同时上传</p>
</blockquote>



<pre class="prettyprint hljs-dark"><code class="hljs groovy"><div class="hljs-line"><span class="hljs-string">url:</span> <span class="hljs-string">'localhost:3000/common/uploadFile'</span>,
</div><div class="hljs-line"><span class="hljs-string">methods:</span> <span class="hljs-string">'post'</span>
</div></code></pre>



<pre class="prettyprint hljs-dark"><code class="hljs sql"><div class="hljs-line">curl -X POST \
</div><div class="hljs-line">  http://localhost:3000/common/uploadFile \
</div><div class="hljs-line">  -H '<span class="hljs-keyword">Cache</span>-Control: <span class="hljs-keyword">no</span>-<span class="hljs-keyword">cache</span><span class="hljs-string">' \</span>
</div><div class="hljs-line"><span class="hljs-string">  -H '</span>Postman-Token: <span class="hljs-number">945</span>a4e44-d2d2<span class="hljs-number">-49</span>d3<span class="hljs-number">-8</span>d4c-c12268ed9f88<span class="hljs-string">' \</span>
</div><div class="hljs-line"><span class="hljs-string">  -H '</span><span class="hljs-keyword">content</span>-<span class="hljs-keyword">type</span>: multipart/<span class="hljs-keyword">form</span>-<span class="hljs-keyword">data</span>; boundary=<span class="hljs-comment">----WebKitFormBoundary7MA4YWxkTrZu0gW' \</span>
</div><div class="hljs-line">  -F files=@/Users/yijie/Desktop/timg.jpeg
</div></code></pre>



<h4 id="服务器返回-2">服务器返回</h4>



<pre class="prettyprint hljs-dark"><code class="hljs json"><div class="hljs-line">{
</div><div class="hljs-line">    <span class="hljs-attr">"code"</span>: <span class="hljs-number">0</span>,
</div><div class="hljs-line">    <span class="hljs-attr">"data"</span>: [
</div><div class="hljs-line">        {
</div><div class="hljs-line">            <span class="hljs-attr">"_id"</span>: <span class="hljs-string">"5b7fec5c011a347c0cb0ce59"</span>
</div><div class="hljs-line">        }
</div><div class="hljs-line">    ]
</div><div class="hljs-line">}
</div></code></pre>



<h3 id="4下载文件"><span id="id4">4.下载文件</span></h3>



<h4 id="客户端-3">客户端</h4>

<table><tbody><tr style="font-weight:bold">  <td>参数</td>  <td>value</td>  <td>类型</td></tr><tr>  <td>fileId</td>  <td>上传文件返回的文件的id</td>  <td>String</td></tr></tbody></table>

<pre class="prettyprint hljs-dark"><code class="hljs livescript"><div class="hljs-line">curl -X GET <span class="hljs-string">\</span>
</div><div class="hljs-line">  <span class="hljs-string">'http://localhost:3000/common/downLoadFile?fileId=5b7fec5c011a347c0cb0ce59'</span> <span class="hljs-string">\</span>
</div><div class="hljs-line">  -H <span class="hljs-string">'Cache-Control: no-cache'</span> <span class="hljs-string">\</span>
</div><div class="hljs-line">  -H <span class="hljs-string">'Postman-Token: 4e8c0348-4175-4a99-8331-b25135478c7f'</span>
</div></code></pre>



<h4 id="服务器返回-3">服务器返回</h4>

<blockquote>
  <p>就是返回的文件</p>
</blockquote></div></body></html>